import request2 from '@/api/axios2';
const getInfoByCode = (params) =>{
    return request2({
        url: '/',
        method: 'get',
        params
    })
}
const get = (params) => {
    return request2({
        url: '/enterprise/pageList',
        method: 'get',
        params
    })
}
const update = (data) =>{
    return request2({
        url: '/energy/update',
        method: 'post',
        data
    })
}

const enterNamePageList = (params) => {
    return request2({
        url: '/enterprise/enterNamePageList',
        method: 'get',
        params
    })
}
const getNameList = (params) => {
    return request2({
        url: '/enterprise/getNameList',
        method: 'get',
        params
    })
}
const getDeviceDataList = (params) => {
    return request2({
        url: '/test/list',
        method: 'post',
        params
    })
}
//basejobList
/**
 * 新增企业信息
 * @param {EnterpriseDTO} data 
 * @returns 
 */
const save = (params) => {
    return request2({
        url: '/enterprise/save',
        method: 'post',
        params
    })
}
/**
 * 获取工作秘钥
 * @param {主键id} params 
 * @returns 
 */
const getSecretKey = (params) => {
    return request2({
        url: '/enterprise/getSecretKey',
        method: 'get',
        params
    })
}
/**
 * 省平台注册
 * @param {主键id} data 
 */
const register = (params) => {
    return request2({
        url: '/enterprise/register',
        method: 'post',
        params
    })
}
/**
 * 修改注册信息
 * @param {主键id} data 
 */
const updateByIdRegister = (params) => {
    return request2({
        url: '/enterprise/updateByIdRegister',
        method: 'post',
        params
    })
}
/**
 * 手动获取token
 * @param {主键id} data 
 * @returns 
 */
const getToken = (params) => {
    return request2({
        url: '/enterprise/getToken',
        method: 'post',
        params
    })
}
/**
 * 编辑
 * @param {EnterpriseDTO} params 
 */
const updateById = (params) => {
    return request2({
        url: '/enterprise/updateById',
        method: 'put',
        params
    })
}
/**
 * 逻辑删除
 * @param {id} data 
 */
const logicDelete = (params) => {
    return request2({
        url: '/enterprise/logicDelete',
        method: 'delete',
        params
    })
}
/**
 * 
 * @param {ids[]} params 
 * 
 */
const logicDeleteBatch =(params)=>{
    return request2({
        url: '/enterprise/logicDeleteBatch',
        method: 'delete',
        params
    })
}

const sbLog = (params) =>{
    return request2({
        url: '/system/pageList',
        method: 'get',
        params
    })
}
const datacollectconfigure = (params)=>{
    return request2({
        url: '/datacollectconfigure/pageList',
        method: 'get',
        params
    })
}
const datacollectconfigureAdd = (data)=>{
    return request2({
        url: '/datacollectconfigure/add',
        method: 'post',
        data
    })
} 
const datacollectconfigureDel = (data)=>{
    return request2({
        url: '/datacollectconfigure/delete/'+data.dataId,
        method: 'post',
        data
    })
} 
const datacollectconfigureUpload = (data)=>{
    return request2({
        url: '/datacollectconfigure/upload',
        method: 'post',
        data
    })
} 
const datacollectconfigureUpdateById = (data) =>{
    return request2({
        url: '/datacollectconfigure/update',
        method: 'post',
        data
    })
}
const eneryUpload = (data) =>{
    return request2({
        url: '/energy/upload/'+data.dataId,
        method: 'post',
        data
    })
}
const eneryUploadBatch=(ids)=>{
    return request2({
        url:'/energy/energyUploadBatch/'+ids,
        method:'post',
        ids
    })
}
const getNameById = (data) =>{
    return request2({
        url:'/enterprise/getNameById/'+data.enterpriseCode,
        method:'get',
    })
}
const getProjectAnaListBypProjectId = (data) =>{
    return request2({
        url:'/ynkbny/getProjectAnaListBypProjectId/?projectId='+data.id,
        method:'post',
        data
    })
}
const getDeviceAnaListByDeviceId = (data) =>{
    return request2({
        url:'/ynkbny/getDeviceAnaListByDeviceId/?deviceId='+data.id,
        method:'post',
        data
    })
}
const saveDataCodeAnalyzeMapping = (data) =>{
    return request2({
        url:'/datacodeanalyzemapping/save',
        method:'post',
        data
    })
}
const getDataCodeAnalyzeMapping = (data) =>{
    return request2({
        url:'/datacodeanalyzemapping/findById?id='+data.id,
        method:'get',
        data
    })
}
const delDataCodeAnalyzeMapping = (data) =>{
    return request2({
        url:'/datacodeanalyzemapping/delete',
        method:'post',
        data
    })
    
}
const getRegionDeviceMessageByProjectId = (data) =>{
    return request2({
        url:'/test/hello',
        method:'get',
        data
    })
    
}

export {
    get,
    getNameList,
    enterNamePageList,
    save,
    update,
    getSecretKey,
    register,
    updateByIdRegister,
    getToken,
    updateById,
    sbLog,
    getInfoByCode,
    datacollectconfigure,
    datacollectconfigureAdd,
    datacollectconfigureDel,
    datacollectconfigureUpload,
    eneryUpload,
    eneryUploadBatch,
    datacollectconfigureUpdateById,
    getNameById,
    getProjectAnaListBypProjectId,
    saveDataCodeAnalyzeMapping,
    getDataCodeAnalyzeMapping,
    delDataCodeAnalyzeMapping,
    getDeviceAnaListByDeviceId,
    getRegionDeviceMessageByProjectId,
    getDeviceDataList,
    logicDelete,
    logicDeleteBatch
}